home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-02-28 | 5.1 KB | 153 lines | [TEXT/R*ch] |
- AuxForm
- Copyright © 1993, 1994 by Apple Computer, Inc. All rights reserved.
- by Maurice Sharp
-
-
- This sample shows how to add an auxilliary slip to a print or fax slip.
- You should use the enclosed proto (myAuxFormat) as a basis for any of
- your auxilliary slips.
-
- Thanks to John Miller whose question and code formed the start of this
-
- A. What is an auxilliary slip?
- ------------------------------
-
- If you try and print a note item from your Newton and select the Letter
- format, you get an auxilliary slip asking for the address of the
- person to send things to.
-
- In your format specification, there is a slot called auxForm. If you want
- an auxilliary slip, you give this a value that is a quoted symbol. That
- symbol should correspond to a slot in the rootView that is a frame
- for your auxilliary form (see below about how to make these).
-
- If you need extra information you can use an auxilliary slip. There are
- also 2 built in auxilliary information slips you can use...
-
-
- B. Built in AuxForm slips
- -------------------------
-
- You have access to 2 build in auxilliary information slips.
- You can use them by giving the appropriate value for your auxForm slot:
-
- 'addresseeSlip - get the name and address of a person
- 'toSubjectSlip - get a person and subject (used for a Memo)
-
- The slips add extra information to the fields variable that you can
- use when you print or fax your information.
-
- The addresseeSlip adds these slots:
-
- fields.toName - string of the name of the person
- fields.toFullAddress - full address of the person
-
- The toSubjectSlip adds these slots:
-
- fields.toName - string of the name of the person
- fields.title - title of the Memo
-
- NOTE: fields.title is also the title that will show up in the outbox, so
- your code may modify it later. Better check if it still exists!
-
-
- C. Building your own auxForm slip
- ---------------------------------
-
- If none of the system provided auxilliary slips will do, you can always
- build your own. It is relatively simple, but there are a few gotchas.
-
- 1. Start by building your own user proto template with a protoFloater
- (NOT floatNGo) as your base level form. Give your base level form
- a name using the Template Info command
-
- 2. Add a protoStaticText to your auxForm and give the name "explanation"
- using the Template Info command. You MUST call it explanation.
-
- This static text should contain a very brief description of what
- the auxilliary slip is for. No more than about 50 characters.
-
- The proto should be fully justified horizontally, parent top vertical,
- and the text should be centered.
-
- 3. Add prototypes etc you will need to get the information you want
- (i.e., layout your form).
-
- 4. Add code to jam the information you want in the fields variable.
-
- *MAKE SURE* that you initialize those slots you jam in fields to
- some reasonable default.
-
- 5. Add code to *resize* the auxilliary form to the correct place and size
- on the Newton (i.e., just below the print/fax slip)
-
- (see below)
-
- 6. Put a symbol in your auxForm slot in your format. The symbol is really
- arbitrary.
-
- something like:
- {
- ...
- auxForm: 'myAuxSlip,
- ...
- }
-
- 7. Add code to your application to add the new auxilliary slip to
- the rootView. Make sure the symbol for the slip is the same as the
- symbol you used in step 5.
-
- Since you used a user proto template to create the slip, your code
- to put it in the root view will look something like:
-
- GetRoot().myAuxSlip := BuildContext(pt_myAuxSlipProto) ;
-
- 8. Use the new information in your print templates (see other docs on
- building and using print templates)
-
-
- D. Resizing Those AuxForm slips
- -------------------------------
-
- You must make sure that your slip shows up just below the print/fax slip.
- You can not rely on the coordinates used in the current product, so you
- should base yourself on the slip.
-
- See the viewSetupFormScript in the proto included in the sample code
- (here it is below...)
-
- viewSetupFormScript:
- func()
- begin
- // adjust viewbounds to be right under the printslip
- // (or faxslip, they both have the same bottom)
- local printBounds := GetRoot().printslip.viewBounds ;
- local myHeight := viewBounds.bottom - viewBounds.top ;
- local newViewbounds := {} ;
-
- newViewBounds.left := printBounds.left ;
- // add 10 to account for frame of this floater and
- // the other floater (i.e., frame size is in addition
- // to viewBounds.
- newViewBounds.top := printBounds.bottom + 10 ;
- newViewBounds.right := printBounds.right ;
- newViewBounds.bottom := newViewBounds.top + myHeight + 10 ;
-
- self.viewBounds := newViewBounds ;
-
- end,
-
- E. Accessing Data in AuxForm Slips
- ----------------------------------
-
- Your auxForm slip will add information to the fields variable that
- your own format can use when printing/faxing. In other words,
- there will be some script in your auxForm that adds a slot (or slots) to
- the fields frame and keeps that slot up to date.
-
- To help you do that, the auxForm will get 2 slots added to it:
-
- fields: the fields variable that you can change and look at
- target: the target of the route as set by your application
-
-